package com.course.web.view;

import com.course.web.component.custom.TeacherGrid;
import com.course.web.page.AdminUI;
import com.vaadin.navigator.View;
import com.vaadin.navigator.ViewChangeListener;
import com.vaadin.spring.annotation.SpringView;
import com.vaadin.ui.CustomComponent;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * Created by Justin on 2017/5/14.
 */
@SpringView(name = TeacherListView.NAME, ui = AdminUI.class)
public class TeacherListView extends CustomComponent implements View {
    public static final String NAME = "teacher-list";

    private final TeacherGrid teacherGrid;

    @Autowired
    public TeacherListView(TeacherGrid teacherGrid) {
        this.teacherGrid = teacherGrid;
        setCompositionRoot(teacherGrid);
        setSizeFull();
    }

    @Override
    public void enter(ViewChangeListener.ViewChangeEvent event) {
        teacherGrid.enter();
    }
}
